package com.putprize.semantic;

import java.io.Serializable;
import java.util.Properties;

import org.apache.log4j.Logger;

import edu.stanford.nlp.ie.AbstractSequenceClassifier;
import edu.stanford.nlp.ie.crf.CRFClassifier;
import edu.stanford.nlp.ling.CoreLabel;


public class SemanticNerer implements Serializable {

	private static final long serialVersionUID = -7410167474169698571L;
	
	private static final Logger _log = Logger.getLogger(SemanticNerer.class);
	
	private AbstractSequenceClassifier<CoreLabel> nr;
	
	public SemanticNerer(Properties prop) {
		
		_log.info("Init STNAFORD NER TAGGER");
		
		String serializedClassifier = prop.getProperty("LOCATION_NER_MODEL");
		
		nr = CRFClassifier.getClassifierNoExceptions(serializedClassifier);
		
		_log.info("Init Done");
	}
	
	public String process(String text) {	
		return nr.classifyToString(text);
	}
}

// GPE
// PERSON
// MISC
// ORG
// LOC
